import { request } from '@/utils';

/**
 * GET请求
 * @param {string} url 
 * @param {T} data 
 * @return {any}
*/
export function GET<T>(url: string, data?: T): Promise<any> {
	return request({
		url,
		method: 'GET',
		data,
	});
};

/**
 * POST请求
 * @param {string} url 
 * @param {T} data 
 * @return {any}
*/
export function POST<T>(url: string, data?: T): Promise<any> {
	return request({
		url,
		method: 'POST',
		data,
	});
}

/**
 * PUT请求
 * @param {string} url 
 * @param {T} data 
 * @return {any}
*/
export function PUT<T>(url: string, data?: T): Promise<any> {
	return request({
		url,
		method: 'PUT',
		data,
	});
}

/**
 * DELETE请求
 * @param {string} url 
 * @param {T} data 
 * @return {any}
*/
export function DELETE<T>(url: string, data?: T): Promise<any> {
	return request({
		url,
		method: 'DELETE',
		data,
	});
}